package com.zegome.game.oanquan.scene;
import java.util.Vector;
public class StringHelper {
	public static String[] split(String source, char delimiter) {   	    	
    	String tmp;
        Vector<String> v = new Vector<String>();
        int startIndex = 0;
        int idx = source.indexOf(delimiter, startIndex);                       
        if (idx < 0) {
            return null;
        }        
        while (idx >= 0) {
            tmp = source.substring(startIndex, idx).trim();
            v.addElement(tmp);
            startIndex = idx + 1;
            idx = source.indexOf(delimiter, startIndex);
            tmp = null;
        }
        if (v.size() == 0) {
            return null;
        }
        tmp = source.substring(source.lastIndexOf(delimiter) + 1, source.length());
        v.addElement(tmp);
        tmp = null;
        String[] r = new String[v.size()];
        for (int i = 0; i < v.size(); i++) {
            r[i] = v.elementAt(i).toString();
        }
        return r;
    }
}
